package cn.ywsj.ywsjmidtier.controller;


import cn.ywsj.ywsjmidtier.entity.VO.UserBankCardQueryVo;
import cn.ywsj.ywsjmidtier.entity.VO.UserBankCardVo;
import cn.ywsj.ywsjmidtier.service.WechatUserBankCardFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/wechat/member/userbankcard"})
public class WechatUserBankCardController {

    @Autowired
    private WechatUserBankCardFeign cardFeign;

    @RequestMapping({"/ajaxuserbankcardlist"})
    public String ajaxUserBankCardList(UserBankCardQueryVo userBankCardQueryVo) {
        return cardFeign.ajaxUserBankCardList(JsonObjectUtil.ObjectToJson(userBankCardQueryVo));
    }

    @PostMapping(value = {"/adduserbankcard"})
    public String addUserBankCard(UserBankCardVo userBankCardVo, BindingResult result){
       return cardFeign.addUserBankCard(JsonObjectUtil.ObjectToJson(userBankCardVo),result);
    }

    @GetMapping(value = {"/getbankcard"})
    public String getBankCard() {
        return cardFeign.getBankCard();
    }

    @GetMapping(value = {"/gettheirbankcard"})
    public String getTheirBankCard(UserBankCardQueryVo queryVo) {
      return cardFeign.getTheirBankCard(JsonObjectUtil.ObjectToJson(queryVo));
    }

    @PostMapping(value = {"/deletebindingcard"})
    public String deleteBindingCard(UserBankCardVo userBankCardVo, BindingResult result){
       return cardFeign.deleteBindingCard(JsonObjectUtil.ObjectToJson(userBankCardVo),result);
    }

    @PostMapping(value = {"/updatebankcarddefaultstatus"})
    public String updateBankCardDefaultStatus(UserBankCardVo userBankCardVo, BindingResult result){
        return cardFeign.updateBankCardDefaultStatus(JsonObjectUtil.ObjectToJson(userBankCardVo),result);
    }
}
